package net.chenyan.server.service.impl;/**
 * @author chenyan
 * @createTime 2022/4/26 17:08
 * @description description
 */

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.chenyan.server.dao.MvDao;
import net.chenyan.server.po.Mv;
import net.chenyan.server.repository.MvRepository;
import net.chenyan.server.service.MvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


/**
 *@description: TODO
 *@author: chenyan
 *@create: 2022/4/26 17:08
 */
@Service
public class MvServiceImpl extends ServiceImpl<MvDao, Mv> implements MvService {

    @Autowired
    private MvRepository mvRepository;

    public Page<Mv> findAllByNamePage(Pageable pageable, String name){
        return mvRepository.findByNameLike(pageable,name);
    }
    public Page<Mv> findAllBySingerNamePage(int singerId,Pageable pageable){
        return mvRepository.findBySingerName(singerId,pageable);
    }
    public Page<Mv> findAllByLikedNum(Pageable pageable){
        return mvRepository.findByLikedNum(pageable);
    }
    public Page<Mv> findAllByCreateTime(Pageable pageable){
        return mvRepository.findByCreateTime(pageable);
    }

    @Override
    public Page<Mv> findAllMvByUserId(Pageable pageable, int userId) {
        return mvRepository.findMvByUserId(userId,pageable);
    }
}
